/**
 * Created by Administrator on 2017/3/15.
 */
var Input = require('../../../../src/libs/input');
var Button = require('../../../../src/libs/button');
var FormItem = require('../../../../src/libs/form-item');
var HyperLink = require('../../../../src/libs/hyperlink');
var GetCode = require('../../../../src/libs/get-code');

var Step1 = React.createClass({
    getDefaultProps:function() {
        return{
            pagedm:this.props.pagedm
        }
    },
    componentDidMount:function(){
        var PageDM = window.PageDM;
        UEventHub.on(PageDM.imgBtn.dmbind + UI_EVENT_CONST.SET_UDM_VALUE_EVENT,function(v){
            var _node = this.refs.imgcode;
            _node.setAttribute('src',PageDM.imgBtn.getValue());
        }.bind(this));
    },
    render:function(){
        var pagedm = this.props.pagedm;

        return(
            <div className="form-reg">
                <FormItem label={pagedm.phone.label} dmbind={pagedm.phone.dmbind}>
                    <Input placeholder={pagedm.phone.placeholder} dmbind={pagedm.phone.dmbind}/>
                </FormItem>
                <FormItem label={pagedm.imgCode.label} dmbind={pagedm.imgCode.dmbind}>
                    <Input placeholder={pagedm.imgCode.placeholder} className="ucs-input code" dmbind={pagedm.imgCode.dmbind}/>
                    <HyperLink text={<img src={pagedm.imgBtn.value} className="f-left img-code" ref="imgcode" style={{height:"40px"}}/>} onclick={pagedm.imgBtn.onClick}/>
                </FormItem>
                <FormItem label={pagedm.msgCode.label} dmbind={pagedm.msgCode.dmbind}>
                    <Input placeholder={pagedm.msgCode.placeholder} dmbind={pagedm.msgCode.dmbind} className="ucs-input code"/>
                    <GetCode count={pagedm.msgBtn.count} text={pagedm.msgBtn.text?pagedm.msgBtn.text:"获取验证码"} onclick={pagedm.msgBtn.onClick} className="btn-code"/>
                </FormItem>
                <div className="form-group auto-height form-btn">
                    <label>&nbsp;</label>
                    <Button value="下一步" className="ucs-btn-confirm btn-width" onclick={pagedm.btnNext1.onClick}/>
                </div>
            </div>
        )
    }
});
module.exports = Step1;